; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=gvn-sink -S < %s | FileCheck %s

; This would assert/crash because the calls have different numbers of operands:
; https://bugs.llvm.org/show_bug.cgi?id=42346

%vec = type opaque
%map = type { i32 }

define void @PR42346() {
; CHECK-LABEL: @PR42346(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[CALL1:%.*]] = call ptr @bar(ptr undef, ptr undef)
; CHECK-NEXT:    br label [[EXIT:%.*]]
; CHECK:       if:
; CHECK-NEXT:    [[CALL2:%.*]] = call ptr @baz(ptr undef)
; CHECK-NEXT:    br label [[EXIT]]
; CHECK:       exit:
; CHECK-NEXT:    ret void
;
entry:
  %call1 = call ptr @bar(ptr undef, ptr undef)
  br label %exit

if:
  %call2 = call ptr @baz(ptr undef)
  br label %exit

exit:
  ret void
}

declare ptr @bar(ptr, ptr)
declare ptr @baz(ptr)
